from django.contrib.auth.models import Group
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.my_paginate import MyPageNumberPagination
from meiduo_admin.sysmanager.permission_admin_serializsers import PermissionAdminsSerializer, \
    PermissionAdminSimpleSerializer
from user.models import User


class PermissionAdminsViewSet(ModelViewSet):
    queryset = User.objects.filter(is_staff=1,is_superuser=1)
    pagination_class = MyPageNumberPagination
    serializer_class = PermissionAdminsSerializer



class PermissionAdminSimpleView(ListAPIView):
    queryset = Group.objects.all()
    serializer_class = PermissionAdminSimpleSerializer
